/**
 * @ClassName AlkalinityDosageController
 * @Description TODO
 * @Author 沉默小吴
 * @Date 2024/12/24 10:02
 */
package com.tledu.operate.count.controller;

import com.tledu.operate.count.entity.AlkalinityDosage;
import com.tledu.operate.count.entity.vo.AlkalinityDosageJSON;
import com.tledu.operate.count.service.IAlkalinityDosageService;
import com.tledu.operate.count.util.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@CrossOrigin(origins = "http://localhost")
public class AlkalinityDosageController {
    @Autowired
    private IAlkalinityDosageService alkalinityDosageServiceImpl;

    @GetMapping("/api/data")
    public List<AlkalinityDosageJSON> getDataByDateRange(
            @RequestParam String startDate,
            @RequestParam String endDate) {
        return alkalinityDosageServiceImpl.findByDateRange(DateUtils.initializeDateTimes(startDate, endDate)[0], DateUtils.initializeDateTimes(startDate, endDate)[1]);
    }
}